package sample.plugin.language.python.decision;


import com.rapid.api.lang.engine.highlight.token.TokenModel;

import sample.plugin.language.base.AbstractDecision;
import sample.plugin.language.python.PythonState;
import sample.plugin.language.python.PythonToken;

public abstract class PythonDecision extends AbstractDecision<PythonState> {
    public TokenModel getNextNonEmptyToken(TokenModel model) {
        model = model.next;
        while (model != null) {
            if (model.token != PythonToken.WHITESPACE && model.token != PythonToken.NEWLINE) {
                return model;
            }
            model = model.next;
        }
        return null;
    }

    public TokenModel getPrevNonEmptyToken(TokenModel model) {
        model = model.prev;
        while (model != null) {
            if (model.token != PythonToken.WHITESPACE && model.token != PythonToken.NEWLINE) {
                return model;
            }
            model = model.prev;
        }
        return null;
    }
}
